package com.xja.controller;

import com.xja.entity.Bookinfo;
import com.xja.entity.PageResult;
import com.xja.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @author 周广瑞
 * @date 2022/4/26 19:28
 */
@Controller
@RequestMapping("book")
public class BookController {

    @Autowired
    private BookService bookService;

    @RequestMapping("list")
    public String list(Model model){

        PageResult<List<Bookinfo>> pageResult = bookService.findallweb();
        System.out.println("。。。。。。。。。。。");
        if (pageResult.getStatus().equals("succes")){
            List<Bookinfo> bookinfoList =pageResult.getObj();
            model.addAttribute("bookInfoList",bookinfoList);
        }
        return "book_list";
    }
}
